 import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
// @ts-ignore
import Cookies from 'js-cookie';
import Element from 'element-ui';
import './assets/styles/element-variables.scss';
import '@/assets/styles/index.scss'; // global css
import '@/assets/styles/lemon.scss'; // lemon css
import './assets/icons'; // icon
import '@/permission';
import directive from './directive';
import plugins from './plugins';
import VueMeta from 'vue-meta';
/** 定义全局XSS解决方法 */
import customXss from '@/utils/customXss';
import ImageCropper from '@/components/ImageCropper/index.vue';
import mavonEditor from 'mavon-editor';
import 'mavon-editor/dist/css/index.css';
// tinymce富文本组件，全版
import TinymceEditor from '@/components/Tinymce/TinyMceEditor.vue';
// 评论富文本组件
import EditorComment from '@/components/EditorComment/index.vue';
// 右键菜单组件
import VueContextMenu from '@xunlei/vue-context-menu';
// 浏览器动态标题
import VueWechatTitle from 'vue-wechat-title';
// 字典数据组件
import DictData from '@/components/DictData';

/** 全局组件挂载 */
Vue.component('ImageCropper', ImageCropper);
Vue.component('TinymceEditor', TinymceEditor);
Vue.component('ContextMenu', VueContextMenu);
Vue.component('EditorComment', EditorComment);

Vue.prototype.$xss = (val: string) => {
  return customXss.process(val);
};

Vue.use(directive);
Vue.use(VueMeta);
Vue.use(plugins);
Vue.use(mavonEditor);
Vue.use(VueContextMenu);
Vue.use(VueContextMenu);
Vue.use(VueWechatTitle);
DictData.install();

/** set element-ui default size */
Vue.use(Element, {
  size: Cookies.get('size') || 'medium'
});

new Vue({
  router,
  store,
  render: (h) => h(App)
}).$mount('#app');
